<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <input type="text" name="" id="week" placeholder="请输入数字(限1-7)">
    <button id="btn">确定</button>
    <input type="text" name="" id="week1">
    <input type="text" name="" id="week2" placeholder="请输入数字(限1-7)">
    <button id="btn1">确定</button>
    <input type="text" name="" id="week3">
    <script>
        // plan1
        document.getElementById("btn").onclick = function() {
                var _week = Number(document.getElementById("week").value);
                if (_week >= 0 && _week <= 6) {
                    if (_week === 1) {
                        document.getElementById("week1").value = "星期一";
                    } else if (_week === 2) {
                        document.getElementById("week1").value = "星期二";
                    } else if (_week === 3) {
                        document.getElementById("week1").value = "星期三";
                    } else if (_week === 4) {
                        document.getElementById("week1").value = "星期四";
                    } else if (_week === 5) {
                        document.getElementById("week1").value = "星期五";
                    } else if (_week === 6) {
                        document.getElementById("week1").value = "星期六";
                    } else if (_week === 0) {
                        document.getElementById("week1").value = "星期天";
                    } else {
                        document.getElementById("week1").value = "请输入整数谢谢合作";
                    }
                } else {
                    document.getElementById("week1").value = "输入错误"
                }
            }
            //plan2
        document.getElementById("btn1").onclick = function() {
            var _week2 = Number(document.getElementById("week2").value);
            switch (_week2) {
                case _week2 = 0:
                    document.getElementById("week3").value = "星期天";
                    break;
                case _week2 = 1:
                    document.getElementById("week3").value = "星期一";
                    break;
                case _week2 = 2:
                    document.getElementById("week3").value = "星期二";
                    break;
                case _week2 = 3:
                    document.getElementById("week3").value = "星期三";
                    break;
                case _week2 = 4:
                    document.getElementById("week3").value = "星期四";
                    break;
                case _week2 = 5:
                    document.getElementById("week3").value = "星期五";
                    break;
                case _week2 = 6:
                    document.getElementById("week3").value = "星期六";
                    break;
                default:
                    document.getElementById("week3").value = "请正确输入";
                    break;
            }
        }
    </script>
</body>

</html>